package pojo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;

@Component
public class PojoRedisImpl {
    @Autowired
    private RedisTemplate redisTemplate;

    public void hello(){

        ValueOperations<String, String> operations = redisTemplate.opsForValue();
        operations.set("abc","aaa");

    }

    public void hello2(){

        ValueOperations operations = redisTemplate.opsForValue();
        operations.set("abcd",123);
        Integer result = (Integer) operations.get("abcd");
        System.out.println("result = " + result);

    }


    public void hello3(){

        Emp emp = new Emp(100, "abcdef");
        ValueOperations operations = redisTemplate.opsForValue();
        operations.set("emp",emp);
        Emp emp1 = (Emp) operations.get("emp");
        System.out.println(emp1);

    }

}
